CRITICAL: 3
};
+// The privacy of the details of a notification. USER is for notifications which
+// contain private information to the originating user account (for example,
+// details of an e-mail they’ve received). SYSTEM is for notifications which
+// contain information private to the physical system (for example, battery
+// status) and hence the same for every user. This affects whether the content
+// of a notification is shown on the lock screen.
+var PrivacyScope = {
+ USER: 0,
+ SYSTEM: 1,
+};
+
var FocusGrabber = class FocusGrabber {
constructor(actor) {
this._actor = actor;
this.resident = false;
// 'transient' is a reserved keyword in JS, so we have to use an alternate variable name
this.isTransient = false;
+ this.privacyScope = PrivacyScope.USER;
this.forFeedback = false;
this._acknowledged = false;
this.bannerBodyText = null;
this.forFeedback = forFeedback;
}
+ setPrivacyScope(privacyScope) {
+ this.privacyScope = privacyScope;
+ }
+
playSound() {
if (this._soundPlayed)
return;
return new NotificationPolicy();
}
+ get narrowestPrivacyScope() {
+ return this.notifications.every(n => n.privacyScope == PrivacyScope.SYSTEM) ? PrivacyScope.SYSTEM
+ : PrivacyScope.USER;
+ }
+
setTitle(newTitle) {
this.title = newTitle;
this.emit('title-changed');
// of the 'transient' hint with hints['transient'] rather than hints.transient
notification.setTransient(!!hints['transient']);
+ let privacyScope = (hints['x-gnome-privacy-scope'] || 'user');
+ notification.setPrivacyScope(privacyScope == 'system' ? MessageTray.PrivacyScope.SYSTEM
+ : MessageTray.PrivacyScope.USER);
+
let sourceGIcon = source.useNotificationIcon ? gicon : null;
source.processNotification(notification, sourceGIcon);
}
return [title, null];
}
+ _shouldShowDetails(source) {
+ return source.policy.detailsInLockScreen ||
+ source.narrowestPrivacyScope == MessageTray.PrivacyScope.SYSTEM;
+ }
+
_showSource(source, obj, box) {
if (obj.detailed) {
[obj.titleLabel, obj.countLabel] = this._makeNotificationDetailedSource(source, box);
_sourceAdded(tray, source, initial) {
let obj = {
visible: source.policy.showInLockScreen,
- detailed: source.policy.detailsInLockScreen,
+ detailed: this._shouldShowDetails(source),
sourceDestroyId: 0,
sourceCountChangedId: 0,
sourceTitleChangedId: 0,
}
_countChanged(source, obj) {
- if (obj.detailed) {
+ // A change in the number of notifications may change whether we show
+ // details.
+ let newDetailed = this._shouldShowDetails(source);
+ let oldDetailed = obj.detailed;
+
+ obj.detailed = newDetailed;
+
+ if (obj.detailed || oldDetailed != newDetailed) {
// A new notification was pushed, or a previous notification was destroyed.
// Give up, and build the list again.
}
_detailedChanged(source, obj) {
- if (obj.detailed == source.policy.detailsInLockScreen)
+ let newDetailed = this._shouldShowDetails(source);
+ if (obj.detailed == newDetailed)
return;
- obj.detailed = source.policy.detailsInLockScreen;
+ obj.detailed = newDetailed;
obj.sourceBox.destroy_all_children();
obj.titleLabel = obj.countLabel = null;